<template>
  <div>
    <button @click="noShake()">点击试试{{time}}</button>
    <router-link :to="{name:'sales'}">param</router-link> 
  </div>
</template>

<script>
  export default {
    data() {
      
      return {
        time: ''
      }
    },
    methods: {
     noShake(){
       if (this.time == 0) {
        let that=this
        that.time = 5; //设定间隔时间（秒）
        //启动计时器，倒计时time秒后自动关闭计时器。
        let index = setInterval(function(){
            that.time--;
            
            if (that.time == 0) {
                clearInterval(index);
                that.time=''
            }
        }, 1000);
 		//此处可写要执行的代码
        console.log('按钮事件被触发');
    }else{
        console.log('目前按钮事件不允许被触发');
    }
     }
    },
  }
</script>

<style lang="scss" scoped>

</style>